package com.hzw.saas.common.config.bo;

import java.io.Serializable;
import java.util.Date;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.hzw.saas.common.util.constants.PatternConsts;
import org.springframework.format.annotation.DateTimeFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

/**
 * @author zzl
 * @since 05/10/2021
 */
@Data
@Accessors(chain = true)
public class BaseBO implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 主键ID
     */
    @ApiModelProperty(value = "主键ID", position = 1)
    protected String pid;

    /**
     * 创建人id
     */
    @ApiModelProperty(value = "创建人id", position = 81)
    protected String creatorId;

    /**
     * 修改人id
     */
    @ApiModelProperty(value = "修改人id", position = 82)
    protected String editorId;

    /**
     * 创建时间
     */
    @ApiModelProperty(value = "创建时间, pattern: " + PatternConsts.NORM_DATETIME_PATTERN, position = 83)
    @JsonFormat(pattern = PatternConsts.NORM_DATETIME_PATTERN)
    @DateTimeFormat(pattern = PatternConsts.NORM_DATETIME_PATTERN)
    protected Date createTime;

    /**
     * 更新时间
     */
    @ApiModelProperty(value = "更新时间, pattern: " + PatternConsts.NORM_DATETIME_PATTERN, position = 84)
    @JsonFormat(pattern = PatternConsts.NORM_DATETIME_PATTERN)
    @DateTimeFormat(pattern = PatternConsts.NORM_DATETIME_PATTERN)
    protected Date updateTime;

    public void pureBase() {
        this.pureId();
        this.pureCreate();
        this.pureUpdate();
    }

    public void pureId() {
        this.pid = null;
    }

    public void pureCreate() {
        this.createTime = null;
        this.creatorId = null;
    }

    public void pureUpdate() {
        this.updateTime = null;
        this.editorId = null;
    }

}
